package com.ld.common.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ld.shieldsb.common.core.model.Result;
import com.ld.shieldsb.common.core.model.ResultCode;
import com.ld.shieldsb.common.web.exception.ParamsterValidException;

@ControllerAdvice
public class ProjectExceptionHandler extends GlobalDefaultExceptionHandler {

    // 参数异常(搜索时解密或者验证是否属于查询类的)
    @ExceptionHandler(ParamsterValidException.class)
    @ResponseBody
    @Override
    public Result paramsterValidException(ParamsterValidException e) {
        String tips = "参数异常1：" + e.getMessage();
        Result result = new Result(false, ResultCode.ERROR_PARAM_NOT_VALID, tips);
        return result;
    }

}